import service from "@/utils/request";

// 获取供应商列表
export const getSupplierList = (
  Supplier_VenDorCode: string,
  Supplier_ResponsiblePhone: string,
  Supplier_VendorName: string,
  Supplier_Markets: string,
  Supplier_Salesman: string,
  Supplier_UseState: boolean,
  page: number,
  size: number
) => {
  return service.get("api/app/supplier/supplier-list", {
    params: {
      Supplier_VenDorCode: Supplier_VenDorCode,
      Supplier_ResponsiblePhone: Supplier_ResponsiblePhone,
      Supplier_VendorName: Supplier_VendorName,
      Supplier_Markets: Supplier_Markets,
      Supplier_Salesman: Supplier_Salesman,
      Supplier_UseState: Supplier_UseState,
      Page: page,
      Size: size,
    },
  });
};

// 获取供应商详情
export const getSupplierDetail = (id: string) => {
  return service.get(`api/app/supplier/${id}/supplier`);
};

//添加供应商
export const addSupplierList = (data: any) => {
  return service.post("api/app/supplier/supplier", data);
};

//删除供应商
export const deleteSupplierList = (id: string) => {
  return service.delete(`api/app/supplier/${id}/supplier`);
};

//编辑供应商
export const updateSupplierList = (data: any) => {
  return service.put(`api/app/supplier/supplier`, data);
};

//导出供应商
export const exportSupplierList = (
  Supplier_VenDorCode: string,
  Supplier_ResponsiblePhone: string,
  Supplier_VendorName: string,
  Supplier_Markets: string,
  Supplier_Salesman: string,
  Supplier_UseState: boolean,
  page: number,
  size: number
) => {
  return service.get("api/app/supplier/export-excel", {
    params: {
      Supplier_VenDorCode: Supplier_VenDorCode,
      Supplier_ResponsiblePhone: Supplier_ResponsiblePhone,
      Supplier_VendorName: Supplier_VendorName,
      Supplier_Markets: Supplier_Markets,
      Supplier_Salesman: Supplier_Salesman,
      Supplier_UseState: Supplier_UseState,
      Page: page,
      Size: size,
    },
  });
};
